﻿using System.Web.Mvc;

namespace LogManager.Helpers
{
    public static class MenuUrlHelper
    {
        public static bool HasController(this UrlHelper helper, string controller)
        {
            return (string) helper.RequestContext.RouteData.Values["controller"] == controller;
        }

        public static bool HasLog(this UrlHelper helper, string log)
        {
            return GetLogName(helper) == log;
        }

        public static bool HasAction(this UrlHelper helper,string action)
        {
            return (string) helper.RequestContext.RouteData.Values["action"] == action;
        }

        public static bool HasServer(this UrlHelper helper, string server)
        {
            return GetLogName(helper) == server;
        }

        public static string GetLogName(this UrlHelper helper)
        {
            return (string) helper.RequestContext.RouteData.Values["logName"];
        }

        public static string GetServerName(this UrlHelper helper)
        {
            return (string) helper.RequestContext.RouteData.Values["logName"];
        }
    }
}